#!/bin/bash
CXX=g++

CXXFLAGS="-std=c++11 -O2 -pthread"

INCLUDE="-I."

SOURCES="main.cpp SerialPort.cpp"

TARGET="SerialToIocHub"

LDFLAGS="-L. -pthread -lIoCHub_Linux"

echo "编译中..."

$CXX $CXXFLAGS $INCLUDE $SOURCES -o $TARGET $LDFLAGS

if [ $? -eq 0 ]; then
    echo "编译成功！运行：./$TARGET -c /dev/tty..."
else
    echo "编译失败"
    exit 1
fi